<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>套餐权限管理</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../../include/commonFile.jsp" %>
</head><body>
<!--头部-->
<%@include file="../../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/charge/packagePrivilege/list.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo" value="${page.page}"/>
                <input type="hidden" name="packageId" value="${dbPackage.id}"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <%--<ul class="search-form-content">
                            <li class="form-item-inline"><label class="search-form-lable">权限名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="name" autocomplete="off" class="layui-input" value="${privilege.name}" placeholder="请输入查询权限名称">
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable">权限编码</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="code" autocomplete="off" class="layui-input" value="${privilege.code}" placeholder="请输入查询权限编码">
                                </div>
                            </li>
                        </ul>--%>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">发布时间</label>
                                <div class="check-btn-inner" id="timeType">
                                    <a id="all" href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${empty input.timeType || input.timeType == 0 ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${input.timeType == 1 ? 'class="active"' : ''}>今天</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),2,'#myForm')" ${input.timeType == 2 ? 'class="active"' : ''}>本周内</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),3,'#myForm')" ${input.timeType == 3 ? 'class="active"' : ''}>本月内</a>
                                    <input type="hidden" name="timeType" value="${input.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart"
                                               value="${input.createStart}" placeholder="开始日">
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd"
                                               value="${input.createEnd}" placeholder="截止日">
                                    </div>
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger"
                                       href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal"
                                       href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="list-content mt10">
                <div class="cl">
                    <table class="layui-table">
                        <colgroup>
                            <col>
                            <col>
                            <col>
                            <col>
                            <col>
                            <col>
                        </colgroup>
                        <thead>
                        <tr>
                            <th>名称</th>
                            <th>编码</th>
                            <th>参数值</th>
                            <th>有效状态</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="pp" items="${privileges}">
                            <tr>
                                <td>
                                    <div>${pp.name}</div>
                                </td>
                                <td>
                                    <div>${pp.code}</div>
                                </td>
                                <td>
                                    <div>${pp.paramValue}</div>
                                </td>
                                <td>
                                    <div>${pp.delFlag == "0" ? '有效' : ''}${pp.delFlag == "1" ? '无效' : ''}</div>
                                </td>
                                <td>
                                    <div><fmt:formatDate value="${pp.updateDate}" pattern="yyyy-MM-dd HH:mm"/></div>
                                </td>
                                <td class="opts-btns tb-opts">
                                    <div class="comm-opts"></div>
                                </td>
                            </tr>
                            <c:forEach var="cc" items="${pp.childrens}">
                                <tr>
                                    <td>
                                        <div style="text-indent: 20px">${cc.name}</div>
                                    </td>
                                    <td>
                                        <div>${cc.code}</div>
                                    </td>
                                    <td>
                                        <div>${cc.paramValue}</div>
                                    </td>
                                    <td>
                                        <c:if test="${cc.delFlag == 0}">
                                            <div>有效</div>
                                        </c:if>
                                        <c:if test="${cc.delFlag == 1}">
                                            <div class="red">无效</div>
                                        </c:if>
                                    </td>
                                    <td>
                                        <div><fmt:formatDate value="${cc.updateDate}" pattern="yyyy-MM-dd HH:mm"/></div>
                                    </td>
                                    <td class="opts-btns tb-opts">
                                        <div class="comm-opts">
                                            <a class="green"
                                               href="${ctx}/charge/packagePrivilege/toForm.do?pprivilegeId=${cc.id}">编辑</a>
                                            <a class="red"
                                               href="javascript:txz.deleteObject('确定要删除吗', '${ctx}/charge/packagePrivilege/delete.do?id=${cc.id}&parentId=${cc.parentId}');">删除</a>
                                        </div>
                                    </td>
                                </tr>
                            </c:forEach>
                        </c:forEach>
                        </tbody>
                    </table>
                    <c:if test="${page.totalCount == 0}">
                        <div class="f16 tc mt15">还没有添加权限</div>
                    </c:if>
                </div>
            </div>
            <div id="page_content" class="page-container"></div>
        </div><!--底部-->
        <%@include file="../../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">
    txz.initHeader({
        nav:[{
            name: '套餐管理',
            href: '${ctx}/charge/package/packageList.do'
        },{
            name: '${dbPackage.name}'
        },{
            name: '套餐权限管理',
            curr: true
        }],
        info:'<span class="f12">共<b id="totalCount">${page.totalCount}</b>条记录</span>',
        btns:[{
            name: '添加套餐权限',
            href: '${ctx}/charge/packagePrivilege/toForm.do?packageId=${dbPackage.id}',
            icon: 'add'
        },{
            name: '返回',
            href: '${ctx}/charge/package/packageList.do',
            icon: 'back'
        }]
    });
    $(function () {
        //加载分页
        loadPageNew({elem: 'page_content', totalCount: '${page.totalCount}', limit: '${page.limit}', page: '${page.page}'});
        layui.use(['laydate'], function () {
            var laydate = layui.laydate;
            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]'
            };

            var end = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(start);
            laydate.render(end);
        });
    });
    showActive('${input.createStart}', '${input.createEnd}', '#timeType');
</script>
</body>
</html>